home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / vxbase.zip / VXFORM3.FRM (.txt) < prev    next >
Visual Basic Form  |  1992-03-06  |  26KB  |  591 lines

  1. VXFORM3
  2. Aircraft Brokerage Customers
  3. Form1-
  4. Label1
  5. Tms Rmn
  6. Label2
  7. Last Name, First Name
  8. Tms Rmn
  9. Label3
  10. Company
  11. Tms Rmn
  12. CustCode
  13. Tms Rmn
  14. CustName
  15. Tms Rmn
  16. CustCompany
  17. Tms Rmn
  18. Label4
  19. Address
  20. Tms Rmn
  21. Label5
  22. Tms Rmn
  23. Label6
  24. State
  25. Tms Rmn
  26. CustAddress
  27. Tms Rmn
  28. CustCity
  29. Tms Rmn
  30. A    CustState
  31. Tms Rmn
  32. CustStateHelp
  33. Tms Rmn
  34. Label7
  35. Tms Rmn
  36. Label8
  37.     Res Phone
  38. Tms Rmn
  39. Label9
  40.     Bus Phone
  41. Tms Rmn
  42. Label10
  43. Tms Rmn
  44. CustZip
  45. Tms Rmn
  46. C    CustPhRes
  47. Tms Rmn
  48. D    CustPhBus
  49. Tms Rmn
  50. CustFax
  51. Tms Rmn
  52. Label11
  53. Created
  54. Tms Rmn
  55. Label12
  56. Days on File
  57. Tms Rmn
  58. BuyRecs
  59.     Bu&y Recs
  60. Tms Rmn
  61. Picture1
  62. 9    CustBuyer
  63. Buyer
  64. Tms Rmn
  65. CustSeller
  66. Seller
  67. Tms Rmn
  68. F    CustCdate
  69. Tms Rmn
  70. CustDays
  71. Tms Rmn
  72. Aircraft
  73.     Ai&rcraft
  74. Tms Rmn
  75. Label13
  76. Revised
  77. Tms Rmn
  78. G    CustRdate
  79. Tms Rmn
  80. CustSave
  81. &Save
  82. CustCancel
  83. &Cancel
  84. CustAdd
  85. CustDelete
  86. &Delete
  87. CustMemo
  88. &Memo
  89. CustNext
  90. &Next
  91. CustPrevious
  92.     &Previous
  93. CustBrowse
  94. &Browse
  95. CustExit
  96. E&xit
  97. Label14
  98. Status
  99. Tms Rmn
  100. CustStatus
  101.     Form_LoadX
  102. vxSelectDbf
  103. AircustDbf
  104. Form3ActiveG
  105. CustReturn1
  106. BROWSE_ADD6
  107. CustDataClear
  108. CustStatus
  109. text(
  110. CustSave
  111. Enabled
  112. CustCancel
  113. CustMemoJ
  114. FALSEh
  115. CustAddM
  116. CustDeleteY
  117. BuyRecsU
  118. aircraft
  119. CustCode
  120. BROWSE_EDIT
  121. CustDataLoad
  122. vxTrue
  123. vxRecNo
  124. CustName
  125. CustCompany
  126. CustAddress
  127. CustCity$
  128.     CustState
  129. CustZip
  130.     CustPhRes>
  131.     CustPhBus
  132. CustFax
  133.     CustBuyer
  134. Value6
  135. CustSeller1
  136.     CustCdateO
  137.     CustRdate
  138. CustDaysX
  139. CursorWaitj
  140. EnableCustDatac
  141. vxField
  142. DateCreate
  143. vxDateFormat
  144. xDate
  145. DaysOnFiler
  146. vxDateString
  147. VX_AMERICAN
  148. CustKey
  149. vxUnLock
  150. CursorArrow
  151. DisableCustData&
  152. CustCode_GotFocus
  153. vxCtlLengthL
  154. CustCode_KeyPress
  155. KeyAsciip
  156. CustName_KeyPressy
  157. CustCompany_KeyPress
  158. CustAddress_KeyPress
  159. CustCity_KeyPress
  160. CustZip_KeyPress
  161. CustPhRes_KeyPress
  162. CustPhBus_KeyPress
  163. CustFax_KeyPress
  164. CustState_KeyPress%
  165. CustName_GotFocus=
  166. CustAddress_GotFocusR
  167. CustCity_GotFocush
  168. CustState_GotFocus|
  169. CustZip_GotFocus
  170. CustPhRes_GotFocus
  171. CustPhBus_GotFocus
  172. CustFax_GotFocus>
  173. CustSave_Click
  174. SeekKey
  175. EmptyStringa
  176. vxSeek
  177. AirstateDbf~    
  178. vxSelectNtx
  179. Airstat1Ntx*
  180. IsBuyer
  181. IsSellerB
  182. WasBuyer
  183.     WasSellerU
  184. RDatec
  185. CDate
  186. vxAppendBlank0
  187. vxReplString
  188. vxReplDate
  189. vxWriteE
  190.     RecNumber
  191. vxClose(    
  192.     BuyerOpen!
  193. Airbuy1Ntx
  194. vxEof
  195. vxDeleteRec
  196. vxSkip
  197. RecNum
  198. AirbuyerDbf
  199. AircraftOpenr
  200. Aircraf1Ntx
  201. StatesOpen
  202. CustStateHelp_Click
  203. SaveReturn9
  204. BROWSE_USER
  205. Airstat2Ntx
  206. StateReturn
  207. VXFORM3
  208. vxBrowse
  209. CustAdd_Click
  210. CustCancel_Click
  211. CustBrowse_Click7    
  212. Visible
  213. BrowseCust
  214. CustDelete_Click'
  215. CustExit_Click|
  216. CustNext_Click$
  217. CustNexth
  218. CustPrevious
  219. CustBrowse
  220.     vxDeleted
  221. vxBottom
  222. CustPrevious_Click?
  223. vxBof
  224. vxTop
  225. Form_UnloadT    
  226. Cancel
  227. vxWindowDereg
  228. VXFORM1[
  229.     OpenTypes
  230. OpenCust
  231. OpenAircraft
  232. LinkBuyToSell
  233. LinkSellToBuy
  234.     PackFiles
  235. TestCreateK
  236. TestCopyc    
  237. TestDataCopy
  238.     FileStruc~
  239. CustBuyer_KeyPress7
  240. CustSeller_KeyPress
  241. BuyRecs_Click
  242.     TypesOpen
  243. BofExpr
  244. EofExpr
  245. vxTableDeclare
  246. VX_RED
  247. vxTableField
  248. VX_FIELD
  249. VX_EXPR
  250. BuyerRecB    
  251. BrowseBuyers
  252. BuyerReturn
  253. VXFORM4
  254. Aircraft_Clicko    
  255. AircraftDbf
  256. vxUseDbf
  257. AirtypesDbf
  258. vxUseNtx
  259. Aircraf2Ntx
  260. AircraftReturn
  261. VXFORM5
  262. CustMemo_Click
  263. vxMemoEdit
  264. Form_Paint
  265. vxFormFrame
  266. vxCtlStyle
  267. VX_RAISE
  268.     VX_RECESS
  269. Picture1
  270. BROWSE_DELETE
  271. CustCompany_GotFocus
  272. Form_Load
  273.  On form load analyze results of browse return
  274. Record addition request"
  275.  if user pressed ENTER then file is positioned
  276.  at current record and the record number isn
  277.  returned in CustReturn. In this case we assume
  278.  he wants to edit that record.
  279.  call general proc to load controls-
  280.  can't change key-
  281. a_seller
  282. a_buyer"
  283. Edit record 
  284. CustDataClear
  285.  Clear Form in preparation for add or after successful delete
  286. dd-mmm-yyyy"
  287. dd-mmm-yyyy"
  288. CustDataLoad
  289.  Load data from customer record
  290.  ensure data entry enabled
  291.  extract field values-
  292. a_code
  293. a_name
  294. a_company"
  295. a_address"
  296. a_city
  297. a_state"
  298. a_zip"
  299. a_phoneres
  300. a_phonebus
  301. a_fax"
  302.  Return from logical field interrogation
  303.  vxTrue() is -1 (TRUE) or 0 (FALSE).
  304.  By using the unary negation operator
  305.  we will transform any -1 values to the
  306.  checkbox value 1, which means "selected"
  307. a_buyer"
  308. a_seller
  309.  vxDateFormat() routine returns a date in the-
  310.  format dd-mmm-
  311. y, which the Visual Basic
  312.  DateValue function inderstands. We will put
  313.  the creation date into a variable so we can
  314.  perform some date arithmetic on it to determine
  315.  the number of days on filei
  316. a_cdate"
  317. dd-mmm-yyyy"
  318. use the vxDateString function as an example of
  319.  display dates
  320. a_rdate"
  321.  set customer key for other links-
  322. EnableCustData
  323.  enables all data entry controls on the form
  324.  which are disabled by the CustCancel_Click Proc
  325. DisableCustData
  326.  Disables data entry when the cancel button-
  327.  is presseda
  328. CustCode_GotFocus
  329.  set up text length limit-
  330. a_code#
  331. CustCode_KeyPress
  332.  Convert customer code to uppercase as it is being entered
  333.  also convert enter key to tab
  334. {Tab}"
  335. CustName_KeyPress
  336. {Tab}"
  337. CustCompany_KeyPress
  338. {Tab}"
  339. CustAddress_KeyPress
  340. {Tab}"
  341. CustCity_KeyPress
  342. {Tab}"
  343. CustZip_KeyPress
  344. {Tab}"
  345. CustPhRes_KeyPress
  346. {Tab}"
  347. CustPhBus_KeyPress
  348. {Tab}"
  349. CustFax_KeyPress
  350. {Tab}"
  351. CustState_KeyPress
  352. {Tab}"
  353. CustName_GotFocus
  354. a_name#
  355. CustAddress_GotFocus
  356. a_address"#
  357. CustCity_GotFocus
  358. a_city#
  359. CustState_GotFocus
  360. a_state"#
  361. CustZip_GotFocus
  362. a_zip"#
  363. CustPhRes_GotFocus
  364. a_phoneres#
  365. CustPhBus_GotFocus
  366. a_phonebus#
  367. CustFax_GotFocus
  368. a_fax"#
  369. CustSave_Click
  370.  Validate data when save button is pressed
  371.  verify something in the field
  372. Field cannot be empty"
  373.  verify unique key if adding
  374. Duplicate Key on Add
  375.  verify that state code is in states file-
  376.  on code
  377. State code not found
  378.  set vxbase logical values based on-
  379.  status of check box
  380.  if we're updating a record, save old buyer/seller
  381.  status in case we have to make adjustments to
  382.  the buyer and aircraft files if the status changes
  383. a_buyer"
  384. a_seller
  385.  set up date strings in preparation for replace-
  386. dd-mmm-yyyy"
  387. dd-mmm-yyyy"
  388. a_cdate"
  389.  Data passed. Put it away
  390. a_code
  391. a_name
  392. a_company"
  393. a_address"
  394. a_city
  395. a_state"
  396. a_zip"
  397. a_phoneres
  398. a_phonebus
  399. a_fax"
  400. a_buyer"
  401. a_seller
  402. a_cdate"
  403. a_rdate"
  404.  we might have a new revision date
  405. a_rdate"
  406.  Update status box
  407. Record "
  408.  appended"
  409. Record "
  410.  saved
  411.  enable/display buyer/aircraft buttons
  412.  set global CustKey for links to buyer and aircraft files
  413.  save record number-
  414.  Close states file to free some handles-
  415.  also does vxTableReset-
  416.  Test old buyer status and remove records from buyer
  417.  file if he is no longer a buyer but once wasm
  418.  in VXBMOD.BAS
  419.  in cust code order-
  420. Confirm delete of existing buyer records
  421. b_code
  422.  if delete denied then reset buyer status to true
  423. a_buyer"
  424.  Test old seller status and remove record from aircraft
  425.  file if he is no longer a seller but once was
  426.  in VXBMOD.BAS
  427.  in cust code order-
  428. Confirm delete of existing aircraft record
  429.  if delete denied then reset seller status to true
  430. a_seller
  431.  reopen states file
  432.  in VXBMOD.BAS
  433.  Update Button Status
  434. CustStateHelp_Click
  435.  display a browse window on the state file. If the user
  436.  double clicks a state or presses ENTER on a highlighted
  437.  record, we'll get the record number back and we can
  438.  stuff the state code into CustState.text 
  439.  on state name
  440. State and Provincial Abbreviations
  441.  after a browse, always re-register the database
  442.  with the window with a vxSelectDbf before attemptingA
  443.  to access a field in the help file.
  444. statecode"
  445. CustAdd_Click
  446.  clear form for addition of new record
  447. Record Addition Request"
  448.  ensure data entry enabled
  449.  reset the buttons
  450. CustCancel_Click
  451.  Clear form data and reset button status
  452. Operation cancelled"
  453.  we must disable data entry because the user
  454.  could enter a new record in the blank boxes
  455.  and then press the Add button. The TypeAdd_Click-
  456.  routine clears the form boxes again prior tol
  457.  accepting input so the user's work would be lost-
  458.  and he would be mad.h
  459. CustBrowse_Click
  460.  so we don't close files
  461.  when we unload the form
  462. CustDelete_Click
  463.  get user confirmation of delete
  464. Confirm Delete
  465.  we must also delete any attached buyer and-
  466.  aircraft recordse
  467.  set global CustKey for links to buyer and aircraft filese
  468.  save record number-
  469.  Close states file to free some handles-
  470.  also does vxTableReset-
  471.  delete buyer recordsv
  472.  in VXBMOD.BAS
  473.  in cust code order-
  474. b_code
  475.  delete aircraft record
  476.  in VXBMOD.BAS
  477.  in cust code order-
  478.  reopen states fileu
  479.  in VXBMOD.BAS
  480.  now delete the requested record
  481.  Deleted
  482. Delete failed"
  483. Delete cancelled
  484. CustExit_Click
  485.  current form is unloaded because if needed again
  486.  the form_load proc must be invoked to reset the
  487.  control datad
  488. CustNext_Click
  489.  skip forward one record
  490.  if skip error, only allow exit-
  491. Error on Skip Next. Try Reindex.
  492.  test for end of file 
  493. End of File!
  494. Skipped to record 
  495.  rec unlocked here
  496. CustPrevious_Click
  497.  skip back one recorde
  498.  if skip error, only allow exit
  499. Error on Skip Previous. Try Reindex.
  500.  test for beginning of filer
  501. Beginning of File!
  502. Skipped to record 
  503. Form_Unload
  504.  close customer and state files and reset
  505.  table and restart menu window if we'ree
  506.  NOT being unloaded by BrowseCust 
  507. CustBuyer_KeyPress
  508. {Tab}"
  509. CustSeller_KeyPress
  510. {Tab}"
  511. BuyRecs_Click
  512.  open airtypes file and buyer file
  513.  Set up browse table limited to buyer records
  514.  that match the CustKey. We do this by sending
  515.  the vxTableDeclare proc a beginning ofs
  516.  file expression and an end of file expression.
  517. b_code < '
  518. b_code > '
  519.  The vxBrowse object now knows to limit the-
  520.  records in the table to those that have b_code
  521.  values equal to CustKey. We also scope the records with the
  522.  "6" following the EofExpr and set the quick key index tot
  523.  "7". An explanation follows:d
  524.  The key we are going to use to browse this file isd
  525.  b_code + b_cat, whose elements are 6 long and 3 long
  526.  respectively.  Every record we are interested in has thet
  527.  same b_code (i.e., they all belong to the same customer).
  528.  Setting the scope index to 6 determines the action to be.
  529.  taken when the HOME or END keys are depressed. The normal
  530.  value is 0, which takes you to the first and last logical
  531.  records in the file when HOME or END is hit. If other than
  532.  zero, then the HOME key will result in a softseek on thea
  533.  file to the current key for the length specified by the
  534.  scope index. The END key will softseek to the current key
  535.  plus 1 and then skip back one record to position thet
  536.  record pointer to the last record in the group.
  537.  The quick index is set to 7, which is the first positiony
  538.  of the aircraft type code in the key. We aren't event
  539.  going to display the b_code for the buyer records. Setting
  540.  the quick index to 7 means that the common part of the key
  541.  for the group of records we are interested in (the firste
  542.  6 which form the customer code), will be prepended to the
  543.  quick keys entered at the keyboard before a seek is donee
  544.  on the file. Makes sense, huh?o
  545.  When scoping a file in this fashion, the only thing you
  546.  MUST do is position the record pointer to the first
  547.  record in the group and then pass that record number
  548.  to the vxBrowse proc (the StartRec& parameter).
  549. b_cat"
  550. Description"
  551. b_desc
  552. b_low"
  553. b_high
  554. STR((b_high / b_low)*100,7,2)"
  555.  Because we are interested in only a subset of the possible
  556.  records in the buyer file, we have to determine ourselves
  557.  whether there are any records in the file that match thes
  558.  group. If not, we ask the user if he wants to add a record.
  559.  vxBrowse normally does this, but the file must be empty
  560.  before it asks the question and sets the return value
  561.  accordingly.k
  562.  global var-
  563.  set for browse start rec-
  564. No buyer records. Add?
  565. Aircraft_Click
  566.  there is only one aircraft sell record allowed-
  567.  to a customer so this makes it a little simpler
  568.  Close states file to free some handles-
  569.  also does vxTableReset-
  570.  open airtypes file and aircraft file-
  571. \vb\vxbtest\aircraft.dbf
  572. Error Opening aircraft.dbf. Aborting."
  573. \vb\vxbtest\aircraf1.ntx
  574. \vb\vxbtest\aircraf2.ntx
  575. No aircraft records. Add?"
  576. CustMemo_Click
  577.  Edit memo. Always have an ENABLED form showing to act as-
  578.  parent to the memo window. It also must have the focus.
  579.  Copy the code below EXACTLY to ensure successful memoedits.
  580.  save rec num to goto later-
  581.  make sure form has focus
  582. a_memo#
  583.  reset rec buffera
  584.  unlock the record
  585. Form_Paint
  586.  if delete request from browse, do it now
  587.  because we must let enhanced controls
  588.  paint before asking for delete confirmation
  589. CustCompany_GotFocus
  590. a_company"#
  591.